package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CheckgroupCheckitemMapper {
    /**
     * 根据检查组id查询检查项id
     * @param checkgroupId
     * @return
     */
    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{checkgroupId}")
    List<Integer> findCheckItemIdsByCheckGroupId(Integer checkgroupId);

    /**
     * 新增检查组与检查项的关联关系
     * @param id
     * @param id1
     */
    @Insert("insert into t_checkgroup_checkitem (checkgroup_id,checkitem_id) values (#{id},#{id1})")
    void add(Integer id, Integer id1);

    /**
     * 根据检查组id删除检查项
     * @param groupId
     */
    @Delete("delete from t_checkgroup_checkitem where checkgroup_id=#{groupId}")
    void deleteByGroupId(Integer groupId);
}
